import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: `/api/mes-warehouse/transfer-order/page`,
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

//备料单单独分页接口
export const getPreparationList = (current, size, params, type) => {
  return request({
    url: `/api/mes-warehouse/sheetheader/preparation-page`,
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-warehouse/transfer-order/detail-by-id',
    method: 'get',
    params: {
      id: id
    }
  });
};
export const getDetailTo = (id) => {
  return request({
    url: '/api/mes-warehouse/sheetheader/sheet-detail/list-with-part-master',
    method: 'get',
    params: {
      sheetHeaderIdList: id
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-warehouse/transfer-order/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-warehouse/transfer-order/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/mes-warehouse/transfer-order/submit',
    method: 'post',
    data: row
  });
};

/**
 *  盘点单物料包装详情
 */
export const getAoPackId = (params) => {
  return request({
    url: '/api/mes-warehouse/packing/detail-packing-list',
    method: 'get',
    params
  });
};

export const writeBack = (sheetId) => {
  return request({
    url: '/api/mes-warehouse/sheetheader/erp/back/ao/by/sheetId',
    method: 'get',
    params: {
      sheetId
    }
  });
};
